{% extends "base.html" %}
{% load thumbnail %}
{% load comments %}


{% block title%}
{%if addon_title%}{{addon_title}} Addon{%endif%}
{%endblock%}

{% block content %}



<h1>{{ addon_details.addon_name }}</h1>

<div class="detail-author">(By: <a href='/profile/?id={{addon_details.addon_author.id}}'>{{ addon_details.addon_author }}</a>) -- published: {{ addon_details.addon_pub_date}}</div>
<hr>
This is a 
{% if addon_details.addon_versiontype.id = 1 or addon_details.addon_versiontype.id = 2%}
<font class='error'>{{addon_details.addon_versiontype}}</font>
{%else%}
<font class='stable'>{{addon_details.addon_versiontype}}</font>
{%endif%}
 version
<br>
<table><tr><td>
	<div style='float: left; margin:8px;'>
		{% thumbnail addon_details.addon_image "1024" crop="center" as im %}
		<a href='{{ im.url }}' rel='lightbox'>
		{% thumbnail addon_details.addon_image "400" crop="center" as im %}
		    <img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" style="box-shadow:4px 4px 4px #666;">
		{% endthumbnail %}
		</a>
		{% endthumbnail %}
	</div>
	<h2>Description:</h2>
	
	{{addon_details.addon_description|linebreaksbr}}
</td></tr></table><br>
<div class='votum'>
{% if vote = 1 %}
Rating:  <img src='/static/thumb_up.png'> <font color=green><b>{{upvote}}</b></font> - <img src='/static/thumb_dwn.png'> <font color=red><b>{{downvote}}</b></font>
{%if not_allowed%}
<br>You have already voted on this addon
{%endif%} 
{%else%}
This addon has not been rated yet.
{%endif%}
</div>
<br><br>
<div class='download_addon'>
<h2>Downloads for this addon:</h2>
<table width=100%>
<tr><td>

{% if addon_details.addon_is_gpl%}
This Addon is licensed under the terms of the <a href="http://www.gnu.org/licenses/licenses.en.html" target="_new"><b>GPL</b></a>
{% else %}
<a href='/media/{{ addon_details.addon_license }}' class='detail-header-button'>Download License</a>
{%endif%}
</td><td>

<a href='/media/{{ addon_details.addon_link }}' class='detail-header-button-orange'>Download Addon</a>
</td>
<td>
<center>
Tested with Blender version:<br><div class='detail-header-inset'>{{addon_details.addon_blender_version}}</div></center>
</td>
</tr> 
</table>

</div>
<br>
<hr>
<b>Tags:</b> 
{% for tag in addon_details.addon_tags.all %}
            {{ tag.name }}{% if forloop.last = 0 %},{%endif%}
        {% endfor %}
<br>
<b>Category:</b> {{addon_details.addon_category}}
<br><br><hr>
<div class='comment_box'>
<h2>Comments:</h2>

{% render_comment_form for addon_details %}



{% get_comment_count for addon_details as comment_count %}

<p>This Addon has {{ comment_count }} comment(s).</p>

{% get_comment_list for addon_details as comment_list %}

{% for comment in comment_list %}
    <div class='comment_ind'>
    <b>Posted by:</b> {{comment.user}}  &nbsp;&nbsp;--&nbsp;&nbsp;  <b>on:</b> {{comment.submit_date}}
    <hr>
    {{comment.comment|linebreaksbr}}
    
    </div><br>
{% endfor %}

</div>
{% endblock %}